﻿namespace WatiN.Extensions
{
    using global::WatiN.Core;

    public static class FormCollectionExtensions
    {
        public static bool Exists(this FormCollection formCollection, string formIdOrNameOrValueorClass, bool extension = true)
        {
            return formCollection.Exists(Find.ById(formIdOrNameOrValueorClass)) ||
                formCollection.Exists(Find.ByName(formIdOrNameOrValueorClass)) ||
                formCollection.Exists(Find.ByValue(formIdOrNameOrValueorClass)) ||
                formCollection.Exists(Find.ByClass(formIdOrNameOrValueorClass)) ||
                formCollection.Exists(Find.ByLabelText(formIdOrNameOrValueorClass));
        }
    }
}